﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using AutoMapper;
using MVCCornucopia.Data.Enums;

namespace MVCCornucopia.Common
{
    public class AutomapperHelper
    {

        public class EmployeeOccupationEnumTypeConverter : ITypeConverter<EmployeeOccupation, int>
        {
            public int Convert(EmployeeOccupation source)
            {
                return (int)source;
            }

            public int Convert(ResolutionContext context)
            {
                EmployeeOccupation em = (EmployeeOccupation)context.SourceValue;
                return Convert(em);
            }
        }

        public class GenderEnumTypeConverter : ITypeConverter<Gender, int>
        {
            public int Convert(Gender source)
            {
                return (int)source;
            }

            public int Convert(ResolutionContext context)
            {
                Gender g = (Gender)context.SourceValue;
                return Convert(g);
            }
        }
    }
}